function param=mod2min(param,matind); 
% ==============================================================
% MOD2MIN 
%
% Toolbox: MYMIN.m 
%
% function param=mod2min(param,matind); 
% Transforms the coefficients of the  function to MINIMIZE 
% According to the Minimization Matrix MATIND 
% 
% Inputs 
% -------
% matind   [ Index |aa | bb | cc ] 
% Index    if =1 than a parameter bounded to the interval ( a, b)
%          trasformed such that in the interval ( -inf,inf ) 
%          if =2 take logs such that also interval (-inf,inf )
%          Set b = 0 
%          if = 0 parameter is not transformed 
%          cc column of ones 
% Output 
% -------
% Transformed parameters
% Modified 6/18/03 
% Alejandro Justiniano 
% ----------------------------------------------------------------
if length( param(:) ) ~= size( matind,1 ) 
    error('Size mistmatch PARAM and MATIND')
end 
aa=matind(:,2); 
bb=matind(:,3); 
cc=matind(:,4); 
for ii=1:length(param); 
    if matind(ii,1) == 1 
        cx=2 * ( param(ii) - 0.5* ( aa(ii) + bb(ii) ) )/ ( bb(ii) - aa(ii) ); 
        param(ii) = ( 1/cc(ii) ) * cx / sqrt(1 - (cx^2) );
    elseif matind(ii,1) == 2 
        param(ii) = bb(ii) + ( 1/cc(ii) ) * log( param(ii) - aa(ii) ) ; 
    end
end

        